package com.ganzi.manager.controller;
import com.ganzi.manager.activiti.model.FormInformation;
import com.ganzi.manager.activiti.service.FormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 *表单管理controller
 */
@Controller
@RequestMapping("form")
public class FormController {

    @Autowired
    FormService formService;

    /**
     * 删除表单
     * */
    @ResponseBody
    @PostMapping("delForm")
    public Object delForm(@RequestBody FormInformation formInformation){
        return formService.delForm(formInformation);
    }

    /**
     * 添加表单
     * */
    @RequestMapping(value = "/addForm", method = RequestMethod.POST)
    @ResponseBody
    public Object saveForm(HttpServletRequest request) {
        return formService.addForm(request);
    }

    /**
     * 查询全部表单
     * */
    @RequestMapping(value = "/allForm", method = RequestMethod.POST)
    @ResponseBody
    public Object selectAllForm() {
        return formService.listForm();
    }


    /**
     * 查询全部表单
     * */
    @RequestMapping(value = "/findFormById", method = RequestMethod.POST)
    @ResponseBody
    public Object findFormById(HttpServletRequest request) {
        return formService.findOneForm(request);
    }


    /**
     * 修改表单
     * */
    @RequestMapping(value = "/updateForm", method = RequestMethod.POST)
    @ResponseBody
    public Object updateForm(HttpServletRequest request) {
        return formService.updateForm(request);
    }
}
